Packet Processing Method, Network Node, and System

ABSTRACT

A packet processing method, a network node, and a system includes obtaining, by a first network node, a first packet that includes a segment list, where the segment list includes a segment identifier of a network node on a path used to forward the first packet, obtaining, by the first network node, a segment identifier of a second network node from the segment list, where the second network node is a next-hop segment node of the first network node on the path, replacing, by the first network node, a destination address of the first packet with the segment identifier of the second network node, and adding a network performance parameter of the first network node to the segment list to generate a second packet, and sending, by the first network node, the second packet to the second network node.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Patent ApplicationNo. PCT/CN2018/123292, filed on Dec. 25, 2018, which claims priority toChinese Patent Application No. 201711451059.2, filed on Dec. 27, 2017.The disclosures of the aforementioned applications are herebyincorporated by reference in their entireties.

TECHNICAL FIELD

The present disclosure relates to the communications field, and inparticular, to a packet processing method, a network node, and a system.

BACKGROUND

Segment routing (SR) is a source routing mechanism that can enable anetwork to achieve better scalability and provide functions such astraffic engineering (TE) and a Multiprotocol Label Switching (MPLS)virtual private network (VPN) in a simpler and more flexible manner. Ina software-defined networking (SDN) network architecture, the SRprovides a capability of quick interaction with an upper-layerapplication for the network. When being deployed on an Internet Protocolversion 6 (IPv6) data plane, the SR is referred to as SRv6. In otherapproaches, performance measurement for an SRv6 network is mainly asfollows. A network performance parameter such as a time stamp or a datapacket quantity is recorded by coloring a packet based on a flow label(FL), and then network performance parameters of different nodes areobtained using a centralized controller in order to implement theperformance measurement for the SRv6 network on the controller. However,in all current methods, the network performance parameter needs to beobtained using a specific protocol, resulting in high implementationcomplexity and inflexibility.

SUMMARY

This application provides a packet processing method, a network node,and a system, to provide a flexible network performance parametersending method in order to facilitate flexible network performancecalculation.

According to a first aspect, an embodiment of the present disclosureprovides a packet processing method. The method includes obtaining, by afirst network node, a first packet that includes a segment list, wherethe segment list includes a segment identifier (SID) of a network nodeon a path used to forward the first packet, obtaining, by the firstnetwork node, a SID of a second network node from the segment list,where the second network node is a next-hop segment node of the firstnetwork node on the path, replacing, by the first network node, adestination address of the first packet with the SID of the secondnetwork node, and adding a network performance parameter of the firstnetwork node to the segment list, to generate a second packet, andsending, by the first network node, the second packet to the secondnetwork node. The network performance parameter of the first networknode is used by the second network node to calculate networkperformance.

According to the method, in a process in which the first network nodeforwards the packet using the segment list in the packet, the segmentlist is used to carry the network performance parameter of the firstnetwork node such that transmission of the network performance parameteris more convenient, and the network performance parameter of the firstnetwork node can be sent to the second network node when the firstnetwork node forwards the packet. The second network node may directlyuse the network performance parameter of the first network node tocalculate the network performance such that calculation of the networkperformance is more flexible.

In a possible design, the network performance parameter includes a timeat which the first network node sends the second packet, or the networkperformance parameter includes a quantity of service packets thatcorrespond to a service identifier and that are received by the firstnetwork node before the first network node sends the second packet, andthe service packets that correspond to the service identifier areforwarded along the path. The network performance parameter includes thetime at which the first network node sends the second packet or thequantity of service packets received by the first network node such thata packet forwarding delay or a quantity of lost packets can be measured.

In a possible design, the network performance parameter of the firstnetwork node is added to the SID of the second network node. In a SRv6technology, the segment list is used to specify a displayed forwardingpath. When the first network node is an ingress node for forwarding aSRv6 network packet, the segment list may include no SID of the firstnetwork node. After the first network node replaces the destinationaddress of the packet with an identifier of the next-hop segment node ofthe first network node in the segment list, the identifier of thenext-hop segment node of the first network node in the segment list isno longer used in a subsequent forwarding process. Therefore, a SIDfield of the second network node in the segment list may be repeatedlyused, and the network performance parameter of the first network node isadded to the SID of the second network node such that sending of thenetwork performance parameter is more convenient.

In a possible design, the network performance parameter of the firstnetwork node is stored between the 65^(th) bit and the 128^(th) bit ofthe SID of the second network node in the segment list.

In a possible design, the segment list may alternatively include a SIDof the first network node. Therefore, the network performance parameterof the first network node may be added to the SID of the first networknode.

In a possible design, the network performance parameter of the firstnetwork node is stored between the 65^(th) bit and the 128^(th) bit ofthe SID of the first network node in the segment list.

In a possible design, when the first network node determines that thedestination address of the first packet is the SID of the first networknode, and determines, based on a function part in the SID of the firstnetwork node, that the first network node needs to add the networkperformance parameter to the first packet, the first network node addsthe network performance parameter of the first network node to thesegment list.

In a possible design, the first packet that includes the segment listand that is obtained by the first network node is a service packet thatcorresponds to the service identifier.

According to a second aspect, an embodiment of the present disclosureprovides a packet processing method. The method includes receiving, by asecond network node, a packet that includes a segment list, where thesegment list includes a SID of a network node on a path used to forwardthe packet, and a first SID in the segment list includes a first networkperformance parameter of the first network node, determining, by thesecond network node, that a destination address of the packet is a SIDof the second network node, and calculating, by the second network node,network performance based on the first network performance parameter inresponse to the determining, by the second network node, that adestination address of the packet is a SID of the second network node.

According to the method, the second network node receives the networkperformance parameter that is of the first network node and that iscarried in the segment list, and then calculates the network performancebased on the network performance parameter of the first network node.Therefore, calculation of the network performance is more flexible. Thenetwork performance parameter of the first network node is carried usingthe segment list such that transmission of the network performanceparameter is more convenient, and the network performance parameter ofthe first network node can be sent to the second network node when thefirst network node forwards the packet.

In a possible design, the first network performance parameter includes afirst time at which the first network node sends the packet to thesecond network node, or the first network performance parameter includesa first quantity of service packets that correspond to a serviceidentifier and that are received by the first network node before thefirst network node sends the packet, and the service packets thatcorrespond to the service identifier are forwarded along the path. Theservice identifier may be a service label, an Internet Protocol (IP)address, or a combination of an IP address and a port number, or theservice identifier corresponds to the segment list.

In a possible design, the calculating, by the second network node,network performance based on the first network performance parameterincludes determining, by the second network node, a second time at whichthe second network node receives the packet, and determining that aforwarding delay of sending the packet from the first network node tothe second network node is equal to a difference between the second timeand the first time.

In a possible design, a second SID in the segment list includes a secondnetwork performance parameter of a third network node. The third networknode is a network node between the first network node and the secondnetwork node on the path. The second network performance parameterincludes a third time at which the third network node sends the packetto the second network node. The calculating, by the second network node,network performance based on the first network performance parameterincludes determining, by the second network node, that a forwardingdelay of forwarding the packet from the first network node to the thirdnetwork node is equal to a difference between the third time and thefirst time.

In a possible design, the calculating, by the second network node,network performance based on the first network performance parameterincludes determining, by the second network node, a second quantity ofservice packets that correspond to the service identifier and that arereceived by the second network node before the second network nodereceives the packet, and determining that a quantity of lost packetsduring forwarding of the service packets corresponding to the serviceidentifier from the first network node to the second network node isequal to a difference between the second quantity and the firstquantity.

In a possible design, a second SID in the segment list includes a secondnetwork performance parameter of a third network node. The secondnetwork performance parameter includes a third quantity of servicepackets that correspond to the service identifier and that are receivedby the third network node when the third network node forwards thepacket. The calculating, by the second network node, network performancebased on the first network performance parameter includes determining,by the second network node, that a quantity of lost packets duringforwarding of the service packets corresponding to the serviceidentifier from the first network node to the third network node isequal to a difference between the third quantity and the first quantity.

In a possible design, the first SID is the SID of the second networknode.

In a possible design, the segment list includes a SID of the firstnetwork node. The first SID is the SID of the first network node.

In a possible design, the packet that includes the segment list and thatis received by the second network node is a service packet thatcorresponds to the service identifier.

According to a third aspect, an embodiment of the present disclosureprovides a first network node, to perform the method in any one of thefirst aspect or the possible implementations of the first aspect.Specifically, the first network node includes units configured toperform the method in any one of the first aspect or the possibleimplementations of the first aspect.

According to a fourth aspect, an embodiment of the present disclosureprovides a second network node, to perform the method in any one of thesecond aspect or the possible implementations of the second aspect.Specifically, the second network node includes units configured toperform the method in any one of the second aspect or the possibleimplementations of the second aspect.

According to a fifth aspect, a first network node is provided. The firstnetwork node includes a processor, a network interface, and a memory.The memory may be configured to store program code, and the processor isconfigured to invoke the program code in the memory to perform themethod in any one of the first aspect or the possible implementations ofthe first aspect. Details are not described herein again.

According to a sixth aspect, a second network node is provided. Thesecond network node includes a processor, a network interface, and amemory. The memory may be configured to store program code, and theprocessor is configured to invoke the program code in the memory toperform the method in any one of the second aspect or the possibleimplementations of the second aspect. Details are not described hereinagain.

According to a seventh aspect, a first network node is provided. Thefirst network node includes a main control board and an interface board.The main control board includes a first processor and a first memory.The interface board includes a second processor, a second memory, and aninterface card. The main control board is coupled to the interfaceboard. The first memory may be configured to store program code. Thefirst processor is configured to invoke the program code in the firstmemory, to perform the following operations obtaining a first packetthat includes a segment list, where the segment list includes a SID of anetwork node on a path used to forward the first packet, obtaining a SIDof a second network node from the segment list, where the second networknode is a next-hop segment node of the first network node on the path,and replacing a destination address of the first packet with the SID ofthe second network node, and adding a network performance parameter ofthe first network node to the segment list, to generate a second packet.

The second memory may be configured to store program code. The secondprocessor is configured to invoke the program code in the second memory,to perform the following operation sending the second packet to thesecond network node.

According to an eighth aspect, a second network node is provided. Thesecond network node includes a main control board and an interfaceboard. The main control board includes a first processor and a firstmemory. The interface board includes a second processor, a secondmemory, and an interface card. The main control board is coupled to theinterface board. The second memory may be configured to store programcode. The second processor is configured to invoke the program code inthe second memory, to perform the following operation receiving a packetthat includes a segment list and is sent by a first network node, wherethe segment list includes a SID of a network node on a path used toforward the packet, and a first SID in the segment list includes a firstnetwork performance parameter of the first network node. The firstmemory may be configured to store program code. The first processor isconfigured to invoke the program code in the first memory, to performthe following operations determining that a destination address of thepacket is a SID of the second network node, and calculating networkperformance based on the first network performance parameter.

In a possible implementation, an inter-process communication (IPC)control channel is established between the main control board and theinterface board.

According to a ninth aspect, a service packet processing system isprovided. The system includes the first network node and the secondnetwork node according to the foregoing aspects.

According to a tenth aspect, a computer storage medium is provided. Thecomputer storage medium is configured to store a computer softwareinstruction used by the foregoing first network node or second networknode. The computer software instruction includes a program designed forperforming the foregoing aspects.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the present disclosure moreclearly, the following briefly describes the accompanying drawings usedin the embodiments. It is clear that the accompanying drawings in thefollowing description merely show some embodiments of the presentdisclosure, and a person of ordinary skill in the art can derive othertechnical solutions and accompanying drawings of the present disclosurefrom these accompanying drawings without creative efforts.

FIG. 1 is a schematic diagram of an application scenario of a packetprocessing method according to an embodiment of the present disclosure.

FIG. 2 is a schematic flowchart of a packet processing method accordingto an embodiment of the present disclosure.

FIG. 3 is a schematic flowchart of a packet processing method accordingto an embodiment of the present disclosure.

FIG. 4 is a schematic diagram of packet forwarding based on theapplication scenario shown in FIG. 1 according to an embodiment of thepresent disclosure.

FIG. 5 is a schematic diagram of packet forwarding based on theapplication scenario shown in FIG. 1 according to an embodiment of thepresent disclosure.

FIG. 6 is a schematic flowchart of a packet processing method accordingto an embodiment of the present disclosure.

FIG. 7 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present disclosure.

FIG. 8 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present disclosure.

FIG. 9 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present disclosure.

FIG. 10 is a schematic structural diagram of a first network nodeaccording to an embodiment of the present disclosure.

FIG. 11 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present disclosure.

FIG. 12 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present disclosure.

FIG. 13 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present disclosure.

FIG. 14 is a schematic structural diagram of a second network nodeaccording to an embodiment of the present disclosure.

FIG. 15 is a schematic diagram of a packet processing system accordingto an embodiment of the present disclosure.

DESCRIPTION OF EMBODIMENTS

The following describes the embodiments of the present disclosure withreference to accompanying drawings.

In a process of forwarding a packet in a SRv6 network, an ingress devicefor forwarding the packet in the SRv6 network adds a segment routingheader (SRH) to the packet. The SRH includes a segment list used toidentify a forwarding path. The segment list includes an IPv6 address ofa network node on the path used to forward the packet. The ingressdevice for forwarding the packet in the SRv6 network may also bereferred to as an ingress node or an ingress provider edge (PE) device.In a SRv6 technology, the IPv6 address of the network node in thesegment list may also be referred to as a SID of the network node. Thesegment list may also be referred to as a path SID list. The SIDoccupies 128 bits (bit). The SID includes two parts a locator and afunction. The locator is used to route the packet to the network nodecorresponding to the SID. For example, the locator includes first 64bits of the IPv6 address of the network node. A forwarding node mayforward, based on the locator, the packet to the network nodecorresponding to the locator. The function is used to instruct thenetwork node corresponding to the SID to perform a correspondingfunction. For example, when the network node receives the packet, if thenetwork node determines that a destination address of the packet is anaddress of the network node, namely, the SID of the network node, thenetwork node performs the corresponding function based on the functionin the SID. For definitions of the segment list and the SID, refer to aSRv6-related draft disclosed by the Internet Engineering Task Force(IETF), for example, draft-filsfils-spring-srv6-network-programming-02.

A controller mentioned in the embodiments of the present disclosure maybe a network management device or a controller in an SDN architecture.The network node in the embodiments of the present disclosure may be anetwork device, for example, a router, a switch, or a forwarder in anSDN network.

FIG. 1 is a schematic diagram of a possible application scenarioaccording to an embodiment of the present disclosure. The applicationscenario includes a network node supporting an SRv6 function, forexample, a network node 101, a network node 102, a network node 103, anetwork node 104, a network node 105, and a network node 106. In an SRv6network, that a network node supports the SRv6 function means that thenetwork node supports a SR function. A SID of the network node 101 is anSID 1. The SID 1 is an IPv6 address of the network node 101, forexample, A::. A SID of the network node 102 is an SID 2. The SID 2 is anIPv6 address of the network node 102, for example, B::. A SID of thenetwork node 103 is an SID 3. The SID 3 is an IPv6 address of thenetwork node 103, for example, C::. A SID of the network node 106 is anSID 6. The SID 6 is an IPv6 address of the network node 106, forexample, D::. When a packet is forwarded from the network node 101 tothe network node 106, the network node 101 may be referred to as aningress node of the SRv6 network and the network node 106 may bereferred to as an egress node of the SRv6 network.

In the SRv6 network, network performance of the SRv6 network is usuallymeasured based on a cross coloring solution for a flow label. In thissolution, 2 bits of a flow label in a packet header of an IPv6 packet isused to color consecutive data packets. Different data packets aredistinguished using different values of 2 bits of flow labels. This isvividly referred to as coloring. With reference to FIG. 1, the networknode 101 assigns 1 to first bits of flow labels of 100 consecutive datapackets, and colors of the 100 data packets are the same. Then, thenetwork node 101 assigns 0 to first bits of flow labels of 100subsequent data packets, and colors of the 100 data packets are a secondcolor. When a color of a data packet received by the network node 106changes, that is, when values of first bits of flow labels of twoadjacent data packets are different, the network node 106 may record anetwork performance parameter. For example, a time at which a datapacket is received is recorded or a quantity of received data packetsthat belong to a same color is recorded. To measure performance, networkperformance parameters of network nodes further need to be synchronized.For example, a controller collects the network performance parameters ofthe nodes, and then measures network performance. For example, thenetwork node 101 records a quantity of packets that are sent by thenetwork node 101 and whose flow labels have first bits with a value 1,and sends the quantity of packets to the controller. The network node106 records a quantity of packets that are received by the network node106 and whose flow labels have first bits with a value 1, and also sendsthe quantity of packets to the controller. The controller performspacket loss detection based on the quantity of packets that is sent bythe network node 101 and the quantity of packets that is received by thenetwork node 106. In the foregoing method for measuring the networkperformance, the network nodes need to separately send the networkperformance parameters to the controller. Therefore, a forwardingchannel needs to be established between each network node and thecontroller in advance using a specific protocol. The solution is complexto be implemented, and is not conducive to solution extension.

The embodiments of the present disclosure provide a packet processingmethod, and a network node and a system that are based on the method.The method, the network node, and the system are based on a sameconcept. Problem-resolving principles of the method, the network node,and the system are similar. Therefore, for embodiments of the networknode, the method, and the system, reference may be made to each other.Same content is not described again.

With reference to the application scenario shown in FIG. 1, referring toFIG. 2, an embodiment of the present disclosure provides a packetprocessing method. The method includes the following steps.

S201. A first network node obtains a first packet including a segmentlist. The segment list includes a SID of a network node on a path usedto forward the first packet.

An example in which the first network node is the network node 101 inFIG. 1 is used for description. In the application scenario shown inFIG. 1, there are two paths from the network node 101 to the networknode 106. Network nodes through which a first path passes include thenetwork node 102, the network node 103, and the network node 106.Network nodes through which a second path passes include the networknode 104, the network node 105, and the network node 106. The networknode 101 obtains a segment list for the first path. SIDs in the segmentlist may be arranged in a reversed order of the network nodes throughwhich the packet passes on the first path. For example, the segment listis <SID 6, SID 3, and SID 2>. Alternatively, SIDs in the segment listmay be arranged in a positive order of the network nodes through whichthe packet passes on the first path. For example, the segment list is<SID 2, SID 3, and SID 6>. The segment list may be generated by thenetwork node 101 in advance, or may be obtained from a controller. Thenetwork node 101 obtains a correspondence between a destination addressof the first packet and the segment list. For example, if thedestination address of the first packet is D::, the first network nodeobtains a correspondence between the address D:: and the segment list<SID 2, SID 3, and SID 6>. The correspondence may be pre-stored in thenetwork node 101, or may be stored in another network node. For example,the correspondence may be pre-stored in the controller. When the networknode 101 receives the first packet, the network node 101 obtains thecorrespondence from the controller. In this example, the network node101 obtains a next-hop segment node of the network node 101 using thesegment list such that the network node 101 may forward the packet tothe network node 106 along the first path. Therefore, the segment listmay include no SID of the network node 101. Optionally, the segment listmay alternatively include a SID of the network node 101. For example,the segment list may be <SID 6, SID 3, SID 2, and SID 1>, or <SID 1, SID2, SID 3, and SID 6>.

S202. The first network node obtains a SID of a second network node fromthe segment list. The second network node is a next-hop segment node ofthe first network node on the path. The next-hop segment node of thefirst network node is a network node that supports a SR function andthat is closest to the first network node in a packet forwardingdirection on the path.

For example, the segment list may be stored in a memory of the firstnetwork node in a form of a data structure. The data structure may be anarray, a linked list, or a structure. For example, when the datastructure is the array, the SID 1 may be a first member in the array,and the SID 2 may be a second member in the array. A processor of thefirst network node may perform a read operation on the second member inthe array stored in the memory, to obtain the SID 2 from the memory.

S203. The first network node replaces the destination address of thefirst packet with the SID of the second network node, and adds a networkperformance parameter of the first network node to the segment list, togenerate a second packet. That the first network node replaces thedestination address of the first packet with the SID of the secondnetwork node means updating a value of a destination address field ofthe first packet to the SID of the second network node. Because the SIDof the second network node is an IPv6 address of the second networknode, that the first network node replaces the destination address ofthe first packet with the SID of the second network node means replacingthe destination address of the first packet with the IPv6 address of thesecond network node.

In an example, that the first network node obtains the first packetmeans that the first network node generates the first packet. Forexample, the first network node is the network node 101 in the scenarioshown in FIG. 1, the second network node is the network node 102, andthe first network node is an ingress node on the path for forwarding thefirst packet. When the network node 101 needs to send an IPv6 packet tothe network node 106, the network node 101 searches the segment listbased on an IPv6 address D:: of the network node 106, and then insertsan SRH between an IPv6 packet header of the IPv6 packet and a packetpayload. The SRH includes the segment list <SID 6, SID 3, and SID 2>.The network node 101 obtains a SID of a next-hop segment node of thenetwork node 101 from the segment list, namely, the segment nodeidentifier SID 2 of the network node 102, and then replaces thedestination address (DA) of the first packet with the SID 2, in otherwords, replaces the value of the destination address field of the firstpacket with the SID 2.

In an example, the first packet is a packet received by the firstnetwork node from terminal equipment. For example, the first networknode is the network node 101 in the scenario shown in FIG. 1, the secondnetwork node is the network node 102. The network node 101 is furtherconnected to source user equipment, the network node 106 is connected totarget user equipment, and the source user equipment and the target userequipment may not support a SR function. When the source user equipmentneeds to send a packet to the target user equipment, the source userequipment generates a user packet whose destination address is anaddress of the target user equipment, and then sends the user packet tothe network node 101. The network node 101 serves as an ingress node forforwarding the user packet in the SRv6 network, and inserts an SRH intothe user packet, to generate the first packet. The SRH includes asegment list <IPv6 address, SID 6, SID 3, and SID 2>. The IPv6 addressis an IPv6 address of the target user equipment. In another case of thisexample, if the source user equipment needs to send the packet to onlythe network node 106, for example, the network node 106 is a serverdevice, the segment list is <SID 6, SID 3, and SID 2>.

In an example, the first packet is a packet received by the firstnetwork node from another network node that supports a SR function. Forexample, the first network node is the network node 102 in the scenarioshown in FIG. 1, and the second network node is the network node 103,and the first network node is an intermediate node in a process offorwarding the first packet. The first network node receives the firstpacket from the network node 101 in FIG. 1. As an ingress node forforwarding the first packet, the network node 101 has added an SRH tothe first packet. The SRH includes a segment list <SID 6, SID 3, and SID2>.

In an example, the first network node may add the network performanceparameter to the SID of the second network node in the segment list. Forexample, when the first network node is the network node 101 in thescenario shown in FIG. 1, and the second network node is the networknode 102, the network performance parameter of the first network node isstored in the SID 2 in the segment list <SID 6, SID 3, and SID 2>.Because each SID includes two parts a locator and a function, after thevalue of the destination address field of the first packet is replacedwith the SID 2, the SID 2 in the segment list can be repeatedly used.For example, the network performance parameter of the first network nodeis stored in the function part of the SID 2, and when the function partoccupies the 65^(th) bit to the 128^(th) bit of the SID 2, the networkperformance parameter of the first network node is stored between the65^(th) bit and the 128^(th) bit of the SID 2. In this example, thelocator may occupy any quantity of bits in only the 1^(st) bit to the64^(th) bit of the SID, and correspondingly, the function occupies bitsother than the bits occupied by the locator in the SID. For example, thelocator occupies the 1^(st) bit to the 50^(th) bit of the SID, and thefunction may occupy the 51^(st) bit to the 128^(th) bit of the SID.Optionally, the function may alternatively occupy only the 90^(th) bitto the 128^(th) bit of the SID.

In an example, when the first network node is the network node 101 inthe scenario shown in FIG. 1, the second network node is the networknode 102, and the segment list further includes a SID of the firstnetwork node, for example, the segment list is <SID 6, SID 3, SID 2, andSID 1>, the first network node may add the network performance parameterof the first network node to the SID of the first network node in thesegment list, for example, store the network performance parameter ofthe first network node in the SID 1 in the segment list <SID 6, SID 3,SID 2, and SID 1>.

In an example, when the first network node is the network node 101 inthe scenario shown in FIG. 1, the second network node is the networknode 102, and the segment list includes no SID of the first networknode, for example, the segment list is <SID 6, SID 3, and SID 2>, thefirst network node may add the network performance parameter of thefirst network node to another field of the first packet, for example, aningress node type-length-value (TLV) field. Another network node maystore a corresponding network performance parameter in a correspondingSID. For example, a network performance parameter of the second networknode is stored in the SID 2 in the segment list <SID 6, SID 3, and SID2>.

S204. The first network node sends the second packet to the secondnetwork node.

S205. The second network node receives the second packet, and whendetermining that a value of a destination address field of the secondpacket is the SID of the second network node, obtains the networkperformance parameter of the first network node in the segment list, andcalculates network performance based on the network performanceparameter of the first network node.

In an example, the network performance parameter of the first networknode includes a first time at which the first network node sends thesecond packet. Alternatively, the network performance parameter of thefirst network node includes a first quantity of service packets thatcorrespond to a service identifier and that are received by the firstnetwork node before the first network node sends the second packet, andthe service packets that correspond to the service identifier areforwarded along the path.

The second network node may calculate the network performance based onthe network performance parameter of the first network node in one ormore of the following manners.

In a first manner, a forwarding delay is calculated.

The second network node determines a second time at which the secondnetwork node receives the first packet, and then determines that aforwarding delay of sending the packet from the first network node tothe second network node is a difference between the second time and thefirst time.

In a second manner, a quantity of lost packets is calculated.

The second network node determines a second quantity of service packetsthat correspond to the service identifier and that are received by thesecond network node before the second network node receives the packet.The second network node determines a quantity of lost packets duringforwarding of the service packets corresponding to the serviceidentifier from the first network node to the second network node. Thequantity of lost packets is equal to a difference between the secondquantity and the first quantity.

According to the method, in a process in which the first network nodeforwards the packet using the segment list in the packet, the segmentlist is used to carry the network performance parameter of the firstnetwork node such that transmission of the network performance parameteris more convenient, and the network performance parameter of the firstnetwork node can be sent to the second network node when the firstnetwork node forwards the packet. The second network node may directlyuse the network performance parameter of the first network node tocalculate the network performance such that calculation of the networkperformance is more flexible.

With reference to the application scenario shown in FIG. 1, referring toFIG. 3, an embodiment of the present disclosure provides a packetprocessing method. The method includes the following steps.

S301. A first network node obtains a first packet including a segmentlist. The segment list includes a SID of a network node on a path usedto forward the first packet.

S302. The first network node obtains a SID of a second network node fromthe segment list. The second network node is a next-hop segment node ofthe first network node on the path.

S303. The first network node replaces a destination address of the firstpacket with the SID of the second network node, and adds a networkperformance parameter of the first network node to the segment list, togenerate a second packet.

S304. The first network node sends the second packet to the secondnetwork node.

In this embodiment of the present disclosure, steps S301, S302, S303,and S304 are the same as steps S201, S202, S203, and S204 in FIG. 2. Fordetailed content, refer to the embodiment shown in FIG. 2. Details arenot described herein again.

S306. When determining that a value of a destination address field ofthe second packet is the SID of the second network node, the secondnetwork node obtains a SID of a third network node from the secondpacket. The third network node is a next-hop segment node of the secondnetwork node on the path.

S307. The second network node replaces a destination address of thesecond packet with the SID of the third network node, and adds a networkperformance parameter of the second network node to the segment list, togenerate a third packet.

In an example, the network performance parameter of the second networknode includes a second time at which the second network node sends thepacket to the third network node. Alternatively, the network performanceparameter of the second network node includes a second quantity ofservice packets that correspond to a service identifier and that arereceived by the second network node when the second network nodeforwards the third packet.

S308. The second network node sends the third packet to the thirdnetwork node.

S309. The third network node receives the third packet, and whendetermining that a value of a destination address field of the thirdpacket is the SID of the third network node, the third network nodecalculates network performance.

The third network node may measure the network performance in one ormore of the following manners.

A first manner of calculating a forwarding delay is as follows.

The third network node determines that a forwarding delay of forwardingthe third packet from the first network node to the second network nodeis equal to a difference between the second time and a first time.

A second manner of calculating a forwarding delay is as follows.

The third network node determines a third time at which the thirdnetwork node receives the third packet, and then determines that aforwarding delay of sending the third packet from the second networknode to the third network node is equal to a difference between thethird time and the second time.

A third manner of calculating a forwarding delay is as follows.

The third network node determines a third time at which the thirdnetwork node receives the third packet, and then determines that aforwarding delay of sending the third packet from the first network nodeto the third network node is equal to a difference between the thirdtime and the first time.

A first manner of calculating a quantity of lost packets is as follows.

The third network node determines that a quantity of lost packets duringforwarding of the service packets corresponding to the serviceidentifier from the first network node to the second network node isequal to a difference between the second quantity and a first quantity.

A second manner of calculating a quantity of lost packets is as follows.

The third network node determines a third quantity of service packetsthat correspond to the service identifier and that are received by thethird network node before the third network node receives the thirdpacket, and then determines that a quantity of lost packets duringforwarding of the service packets corresponding to the serviceidentifier from the second network node to the third network node isequal to a difference between the third quantity and the secondquantity.

A third manner of calculating a quantity of lost packets is as follows.

The third network node determines a third quantity of service packetsthat correspond to the service identifier and that are received by thethird network node before the third network node receives the thirdpacket, and then determines a quantity of lost packets during forwardingof the service packets corresponding to the service identifier from thefirst network node to the third network node. The quantity of lostpackets is equal to a difference between the third quantity and thefirst quantity.

Referring to FIG. 4, FIG. 5, and FIG. 6, an embodiment of the presentdisclosure provides a packet processing method. FIG. 4 and FIG. 5 areschematic diagrams of forwarding a packet in the application scenarioshown in FIG. 1. FIG. 6 is a schematic flowchart of a packet processingmethod according to an embodiment of the present disclosure. Referringto FIG. 6, the method includes the following steps.

S601. A network node 101 obtains a first packet to be sent to a networknode 106. The first packet includes an IPv6 packet header, an SRH, and apayload, as shown in a schematic table of a packet format in FIG. 4. Thenetwork node 101 replaces a destination address of the first packet withan SID 2, adds a network performance parameter of the network node 101to a segment list to generate a second packet, and sends the secondpacket to a network node 102.

In an example, the SRH includes a segment list <SID 6, SID 3, and SID2>, and the network performance parameter (NPP) of the network node 101is included in the SID 2 in the segment list of the first packet. Asshown in FIG. 4, a network performance parameter NPP 1 value of thenetwork node 101 is stored in a function field of the SID 2. In otherwords, the value of an NPP 1 is stored in the function field of the SID2.

In an example, the SRH includes a segment list <SID 6, SID 3, SID 2, andSID 1>. A network performance parameter NPP 1 of the network node 101 isincluded in an SID 1 in the segment list of the first packet. As shownin FIG. 5, the NPP 1 is included in a function field of the SID 1.

S602. The network node 102 receives the second packet, and whendetermining that a value of a destination address field of the secondpacket is the SID 2, the network node 102 obtains the SID 3 from asegment list of the second packet, and replaces a destination address ofthe second packet with the SID 3. When determining that a functioncorresponding to the function field in the SID 2 is to insert a networkperformance parameter, the network node 102 adds a network performanceparameter of the network node 102 to the segment list to generate athird packet, and sends the third packet to a network node 103.

In an example, the SRH includes the segment list <SID 6, SID 3, and SID2>. A network performance parameter NPP 2 of the network node 102 isstored in the SID 3 in the segment list. As shown in FIG. 4, the NPP 2is stored in a function field of the SID 3.

In an example, the SRH includes the segment list <SID 6, SID 3, SID 2,and SID 1>. A network performance parameter NPP 2 of the network node102 is stored in the SID 2 in the segment list. As shown in FIG. 5, theNPP 2 is stored in the function field of the SID 2.

In an example, the network node 101 is the first network node in theembodiment shown in FIG. 2. The network node 102 may be the secondnetwork node in the embodiment shown in FIG. 2. The network node 102 maymeasure network performance based on the network performance parameterin the segment list. For a specific manner of calculating the networkperformance, refer to the embodiment shown in FIG. 2. Details are notdescribed herein again.

S603. The network node 103 receives the third packet, and whendetermining that a value of a destination address field of the thirdpacket is the SID 3, the network node 103 obtains the SID 6 from asegment list in the third packet, and replaces a destination address ofthe third packet with the SID 6. When determining that a functioncorresponding to the function field in the SID 3 is to insert a networkperformance parameter, the network node 103 stores a network performanceparameter of the network node 103 in the segment list to generate afourth packet, and sends the fourth packet to the network node 106.

A meaning of a network performance parameter of a network node in thisembodiment of the present disclosure is similar to that of the networkperformance parameter in the embodiment shown in FIG. 2 or FIG. 3.Details are not described herein again.

In an example, the SRH includes the segment list <SID 6, SID 3, and SID2>. A network performance parameter NPP 3 of the network node 103 isstored in the SID 6 in the segment list. As shown in FIG. 4, the NPP 2is stored in a function field of the SID 6.

In an example, the SRH includes the segment list <SID 6, SID 3, SID 2,and SID 1>. A network performance parameter NPP 3 of the network node103 is stored in the SID 3 in the segment list. As shown in FIG. 5, theNPP 3 is stored in a function field of the SID 3.

In an example, the network node 101 is the first network node in theembodiment shown in FIG. 3, the network node 102 is the second networknode in the embodiment shown in FIG. 3, and the network node 103 is thethird network node in the embodiment shown in FIG. 3. The network node103 may measure network performance based on the network performanceparameter in the segment list. For a specific manner of calculating thenetwork performance, refer to the embodiment shown in FIG. 3. Detailsare not described herein again.

S604. The network node 106 receives the fourth packet, and whendetermining that a value of a destination address field of the fourthpacket is the SID 6, measures network performance based on the networkperformance parameter in the segment list.

In an example, when the segment list is <SID 6, SID 3, and SID 2>,referring to FIG. 4, a network performance parameter of each networknode is stored in a SID of a next-hop segment node corresponding to thenetwork node. For example, the network performance parameter NPP 1 ofthe network node 101 is stored in the SID 2 of the network node 102, thenetwork performance parameter NPP 2 of the network node 102 is stored inthe SID 3 of the network node 103, and the network performance parameterNPP 3 of the network node 103 is stored in the SID 6 of the network node106. When the segment list is <SID 6, SID 3, SID 2, and SID 1>,referring to FIG. 5, a network performance parameter of each networknode is stored in a SID of the network node. For example, the networkperformance parameter NPP 1 of the network node 101 is stored in the SID1 of the network node 101, the network performance parameter NPP 2 ofthe network node 102 is stored in the SID 2 of the network node 102, andthe network performance parameter NPP 3 of the network node 103 isstored in the SID 3 of the network node 103. After the network node 106receives the fourth packet, because the network node 106 is the lastsegment node indicated by the segment list, a network performanceparameter of the network node 106 does not need to be added to thesegment list, and network performance needs to be calculated based ononly the network performance parameter of each network node in thesegment list.

In an example, the network node 106 is further connected to userequipment, a destination of the fourth packet is the user equipment, asegment list included in the SRH is <IPv6 address, SID 6, SID 3, and SID2> or <IPv6 address, SID 6, SID 3, SID 2, and SID 1>. The IPv6 addressis an IPv6 address of the user equipment. The network node 101 stores acorrespondence between the IPv6 address of the user equipment and thesegment list. The network node 106 deletes the SRH from the fourthpacket, and modifies a destination address of the fourth packet to theIPv6 address of the user equipment to generate a fifth packet. Then, thenetwork node 106 sends the fifth packet to the user equipment.

In an example, the network node 101 is the first network node in theembodiment shown in FIG. 3, the network node 102 or the network node 103is the second network node in the embodiment shown in FIG. 3, and thenetwork node 106 may be the third network node in the embodiment shownin FIG. 3. For a specific network performance measurement manner, referto the embodiment shown in FIG. 3. Details are not described hereinagain.

FIG. 7 is a possible schematic structural diagram of a first networknode 700 in the foregoing embodiments. The first network node mayimplement a function of the first network node in the embodiment shownin FIG. 2, FIG. 3, or FIG. 6. Referring to FIG. 7, the first networknode 700 includes an obtaining unit 701, a generation unit 702, and asending unit 703. These units may perform corresponding functions in theforegoing method example. For example, the obtaining unit 701 isconfigured to obtain various information obtained by the first networknode in the foregoing method embodiments. The generation unit 702generates various information generated by the first network node in theforegoing method embodiments. The sending unit 703 is configured to sendvarious information sent by the first network node in the foregoingmethod embodiments. For example, the obtaining unit 701 is configured toobtain a first packet including a segment list, where the segment listincludes a SID of a network node on a path used to forward the firstpacket, and obtain a SID of a second network node from the segment list,where the second network node is a next-hop segment node of the firstnetwork node on the path. The generation unit 702 is configured toreplace a destination address of the first packet with the SID of thesecond network node, and add a network performance parameter of thefirst network node to the segment list, to generate a second packet. Thesending unit 703 is configured to send the second packet to the secondnetwork node.

When an integrated unit is used, FIG. 8 is another possible schematicstructural diagram of the first network node in the foregoingembodiments. The first network node 800 may also implement a function ofthe first network node in the embodiment shown in FIG. 2, FIG. 3, orFIG. 6.

The first network node 800 includes a storage unit 801, a processingunit 802, and a communications unit 803. The processing unit 802 isconfigured to control and manage an action of the first network node800. For example, the processing unit 802 is configured to support thefirst network node 800 in performing the processes S201, S202, and S203in FIG. 2, the processes S301, S302, and S303 in FIG. 3, the processS601 in FIG. 6, and/or another process in the technology described inthis specification. The communications unit 803 is configured to supportcommunication between the first network node 800 and another networkentity, for example, communication with the second network node or thenetwork node 102 shown in FIG. 2, FIG. 3, or FIG. 5. The storage unit801 is configured to store program code and data of the first networknode 800.

The processing unit 802 may be a processor, such as a central processingunit (CPU), a general-purpose processor, a digital signal processor(DSP), an application-specific integrated circuit (ASIC), a fieldprogrammable gate array (FPGA) or another programmable logic device, atransistor logic device, a hardware component, or any combinationthereof. The processor may implement or execute various example logicalblocks, modules, and circuits described with reference to contentdisclosed in the embodiments of the present disclosure. Alternatively,the processor may be a combination for implementing a computingfunction, for example, a combination of one or more microprocessors, ora combination of a DSP and a microprocessor. The communications unit 803may be a transceiver, and the storage unit 801 may be a memory.

When the processing unit 802 is the processor, the communications unit803 is the transceiver, and the storage unit 801 is the memory, thefirst network node in this embodiment of the present disclosure may be afirst network node 900 shown in FIG. 9.

Referring to FIG. 9, the first network node 900 includes a processor902, a transceiver 903, a memory 901, and a bus 904. The transceiver903, the processor 902, and the memory 901 are connected to each otherusing the bus 904. The bus 904 may be a peripheral componentinterconnect (PCI) bus, an extended industry standard architecture(EISA) bus, or the like. The bus may be classified into an address bus,a data bus, a control bus, and the like. For ease of representation,only one thick line is used to represent the bus in FIG. 9, but thisdoes not mean that there is only one bus or only one type of bus.

Referring to FIG. 10, an embodiment of the present disclosure providesanother first network node 1000. The first network node 1000 includes amain control board 1001 and an interface board 1002. The main controlboard 1001 includes a processor 1003 and a memory 1004. The interfaceboard 1002 includes a processor 1005, a memory 1006, and an interfacecard 1007. The main control board 1001 is coupled to the interface board1002.

The hardware may implement a corresponding function of the first networknode in the method example in FIG. 2, FIG. 3, or FIG. 6. For example,the memory 1006 may be configured to store program code of the interfaceboard 1002. The processor 1005 is configured to invoke the program codein the memory 1006 to trigger the interface card 1007 to performreceiving and sending of various information that are performed by thefirst network node in the foregoing method embodiments. The memory 1004may be configured to store program code of the main control board 1001.The processor 1003 is configured to invoke the program code in thememory 1004 to perform processing other than information receiving andsending of the first network node in the foregoing method embodiments.For example, the processor 1003 is configured to obtain a first packetincluding a segment list, where the segment list includes a SID of anetwork node on a path used to forward the first packet, obtain a SID ofa second network node from the segment list, where the second networknode is a next-hop segment node of the first network node on the path,and replace a destination address of the first packet with the SID ofthe second network node, and add a network performance parameter of thefirst network node to the segment list, to generate a second packet. Theprocessor 1005 is configured to receive the second packet sent by themain control board 1001. The interface card 1007 is configured to sendthe second packet to the second network node. The memory 1004 isconfigured to store program code and data of the main control board1001. The memory 1006 is configured to store program code and data ofthe interface board 1002.

In a possible implementation, an IPC control channel is establishedbetween the main control board 1001 and the interface board 1002. Themain control board 1001 communicates with the interface board 1002 usingthe IPC control channel.

The first network node 1000 may be a router, a switch, or a network nodehaving a forwarding function. The first network node 1000 can implementa function of the first network node in the foregoing methodembodiments. For specific execution steps, refer to the foregoing methodembodiments. Details are not described herein again.

FIG. 11 is a possible schematic structural diagram of the second networknode in the foregoing embodiments. The second network node 1100 mayimplement a function of the second network node in the embodiment shownin FIG. 2, FIG. 3, or FIG. 6. Referring to FIG. 11, the second networknode 1100 includes a receiving unit 1101, a determining unit 1102, and aprocessing unit 1103. These units may perform corresponding functions inthe foregoing method example. For example, the receiving unit 1101 isconfigured to receive various information received by the second networknode in the foregoing method embodiments. The determining unit 1102 isconfigured to determine various information determined by the secondnetwork node in the foregoing method embodiments. The processing unit1103 is configured to perform processing other than informationreceiving and sending and information determining that are performed bythe second network node in the foregoing method embodiments. Forexample, the receiving unit 1101 is configured to receive a packet thatincludes a segment list and that is sent by a first network node. Thesegment list includes a SID of a network node on a path used to forwardthe packet. A first SID in the segment list includes a first networkperformance parameter of the first network node. The determining unit1102 is configured to determine that a destination address of the packetis a SID of the second network node 1100. The processing unit 1103 isconfigured to calculate network performance based on the first networkperformance parameter in response to that the determining unit 1102determines that the destination address of the packet is the SID of thesecond network node 1100.

It should be noted that, in this embodiment of the present disclosure,division into units is an example, and is merely logical functiondivision. In an embodiment, there may be another division manner.Function units in this embodiment of the present disclosure may beintegrated into one processing unit, or each of the units may existalone physically, or two or more units may be integrated into one unit.For example, in the foregoing embodiment, the receiving unit and thesending unit may be a same unit or different units. The integrated unitmay be implemented in a form of hardware, or may be implemented in aform of a software function unit.

When an integrated unit is used, FIG. 12 is another possible schematicstructural diagram of the second network node in the foregoingembodiments. The second network node 1200 may also implement a functionof the second network node in the embodiment in FIG. 2, or implement afunction of the third network node in the embodiment shown in FIG. 3, orimplement a function of the network node 106 in the embodiment shown inFIG. 6.

The second network node 1200 includes a storage unit 1201, a processingunit 1202, and a communications unit 1203. The processing unit 1202 isconfigured to control and manage an action of the second network node1200. For example, the processing unit 1202 is configured to support thesecond network node 1200 in performing the process S205 in FIG. 2, theprocess S309 in FIG. 3, the process S604 in FIG. 6, and/or anotherprocess in the technology described in this specification. Thecommunications unit 1203 is configured to support communication betweenthe second network node 1200 and another network entity, for example,communication with the first network node in FIG. 2, or communicationwith the second network node or the network node 103 shown in FIG. 3 orFIG. 6. The storage unit 1201 is configured to store program code anddata of the second network node 1200.

The processing unit 1202 may be a processor, for example, may be a CPU,a general-purpose processor, a DSP, an ASIC, an FPGA or anotherprogramming logic device, a transistor logic device, a hardwarecomponent, or any combination thereof. The processor may implement orexecute various example logical blocks, modules, and circuits describedwith reference to content disclosed in the embodiments of the presentdisclosure. Alternatively, the processor may be a combination forimplementing a computing function, for example, a combination of one ormore microprocessors, or a combination of a DSP and a microprocessor.The communications unit 1203 may be a transceiver. The storage unit 1201may be a memory.

When the processing unit 1202 is the processor, the communications unit1203 is the transceiver, and the storage unit 1201 is the memory, thesecond network node in this embodiment of the present disclosure may bea second network node 1300 shown in FIG. 13.

Referring to FIG. 13, the second network node 1300 includes a processor1302, a transceiver 1303, a memory 1301, and a bus 1304. The transceiver1303, the processor 1302, and the memory 1301 are connected to eachother using the bus 1304. The bus 1304 may be a PCI bus, an EISA bus, orthe like. The bus may be classified into an address bus, a data bus, acontrol bus, and the like. For ease of representation, only one thickline is used to represent the bus in FIG. 13, but this does not meanthat there is only one bus or only one type of bus.

Referring to FIG. 14, an embodiment of the present disclosure providesanother second network node 1400. The second network node 1400 includesa main control board 1401 and an interface board 1402. The main controlboard 1401 includes a processor 1403 and a memory 1404. The interfaceboard 1402 includes a processor 1405, a memory 1406, and an interfacecard 1407. The main control board 1401 is coupled to the interface board1402.

The hardware may implement functions of the second network node in theembodiment shown in FIG. 2, or implement functions of the third networknode in the embodiment shown in FIG. 3, or implement correspondingfunctions of the network node 106 in the embodiment shown in FIG. 6. Forexample, the memory 1406 may be configured to store program code of theinterface board 1402. The processor 1405 is configured to invoke theprogram code in the memory 1406 to trigger the interface card 1407 toperform receiving and sending of various information that are performedby a corresponding network node in the foregoing method embodiments. Thememory 1404 may be configured to store program code of the main controlboard 1401. The processor 1403 is configured to invoke the program codein the memory 1404 to perform processing other than informationreceiving and sending of the corresponding network node in the foregoingmethod embodiments. For example, the interface card 1407 is configuredto receive a packet that includes a segment list and that is sent by afirst network node. The segment list includes a SID of a network node ona path used to forward the packet, and a first SID in the segment listincludes a first network performance parameter of the first networknode. The processor 1405 is configured to send the packet to the maincontrol board 1401. The processor 1403 is configured to determine that adestination address of the packet is a SID of the second network node,and calculate network performance based on the first network performanceparameter. The memory 1404 is configured to store program code and dataof the main control board 1401. The memory 1406 is configured to storeprogram code and data of the interface board 1402.

In a possible implementation, an IPC control channel is establishedbetween the main control board 1401 and the interface board 1402. Themain control board 1401 communicates with the interface board 1402 usingthe IPC control channel.

The second network node 1400 may be a router, a switch, or a networknode having a forwarding function. The second network node 1400 canimplement a function of the corresponding network node in the foregoingmethod embodiments. For specific execution steps, refer to the foregoingmethod embodiments. Details are not described herein again.

Referring to FIG. 15, an embodiment of the present disclosure providesanother service packet processing system 1500. The system 1500 isconfigured to implement the packet processing method in the foregoingmethod embodiment. The system 1500 includes a first network node 1501and a second network node 1502. The first network node 1501 and thesecond network node 1502 may respectively implement functions of thefirst network node and the second network node in the embodiment shownin FIG. 2, or implement functions of the first network node and thethird network node in the embodiment shown in FIG. 3, or implementfunctions of the network node 101 and the network node 106 in theembodiment shown in FIG. 6. For example, the first network node 1501performs the processes S201, S202, S203, and S204 in FIG. 2, theprocesses S301, S302, S303, and S304 in FIG. 3, the process S601 in FIG.6, and/or another process performed by the first network node in thetechnology described in this specification. The second network node 1502is configured to implement the process S205 in FIG. 2, the process S309in FIG. 3, and/or another process performed by the second network nodein the technology described in this specification.

In an example, the system 1500 further includes a third network node.The third network node is configured to implement functions of thesecond network node in the embodiment shown in FIG. 3 or FIG. 2, forexample, perform the processes S306, S307, and S308 in FIG. 3.

An embodiment of the present disclosure further provides a non-volatilestorage medium configured to store a software instruction used in theforegoing embodiment. The software instruction includes a program usedto perform the method shown in the foregoing embodiment. When theprogram is executed on a computer or a network node, the computer or thenetwork node is enabled to perform the method in the foregoing methodembodiment.

“First” in the first network node in the embodiments of the presentdisclosure is merely used as a name identifier, and does not mean beingthe first in a sequence. For the words “second” and “third”, this ruleis also applicable.

It should be noted that any apparatus embodiment described above ismerely an example. The units described as separate parts may or may notbe physically separate, and parts displayed as units may or may not bephysical units, may be located in one position, or may be distributed ona plurality of network units. Some or all of the modules may be selectedbased on an embodiment to achieve the objectives of the solutions of theembodiments. In addition, in the accompanying drawings of theembodiments of the first network node or the controller provided in thepresent disclosure, connection relationships between modules indicatethat the modules have communication connections with each other, whichmay be further implemented as one or more communications buses or signalcables. A person of ordinary skill in the art may understand andimplement the embodiments without creative efforts.

Methods or algorithm steps described in combination with the contentdisclosed in the embodiments of the present disclosure may beimplemented by hardware, or may be implemented by a processor byexecuting a software instruction. The software instruction may include acorresponding software module. The software module may be stored in arandom access memory (RAM), a flash memory, a read-only memory (ROM), anerasable programmable read-only memory (EPROM), an electrically erasableprogrammable read-only memory (EEPROM), a hard disk, a removable harddisk, a compact disc, or any other form of storage medium well-known inthe art. For example, a storage medium is coupled to the processor suchthat the processor can read information from the storage medium, andwrite information into the storage medium. Certainly, the storage mediummay alternatively be a component of the processor. The processor and thestorage medium may be located in an ASIC. In addition, the ASIC may belocated in a core network interface device. Certainly, the processor andthe storage medium may exist in the core network interface device asdiscrete components.

A person skilled in the art should be aware that in the foregoing one ormore examples, functions described in the present disclosure may beimplemented by hardware, software, firmware, or any combination thereof.When the functions are implemented by software, the functions may bestored in a computer-readable medium or transmitted as one or moreinstructions or code in a computer-readable medium. Thecomputer-readable medium includes a computer storage medium and acommunications medium, where the communications medium includes anymedium that facilitates transmission of a computer program from oneplace to another. The storage medium may be any available mediumaccessible to a general-purpose or dedicated computer.

In the foregoing specific implementations, the objectives, technicalsolutions, and beneficial effects of the present disclosure are furtherdescribed in detail. It should be understood that the foregoingdescriptions are merely specific implementations of the presentdisclosure.

What is claimed is:
 1. A packet processing method, implemented by afirst network node, wherein the packet processing method comprises:obtaining a first packet that comprises a segment list, wherein thesegment list comprises a segment identifier of a network node on a paththat forwards the first packet; obtaining a segment identifier of asecond network node from the segment list, wherein the second networknode is a next-hop segment node of the first network node on the path;replacing a destination address of the first packet with the segmentidentifier of the second network node; adding a network performanceparameter of the first network node to the segment list to generate asecond packet; and sending the second packet to the second network node.2. The packet processing method of claim 1, wherein the networkperformance parameter comprises a time at which the first network nodesends the second packet.
 3. The packet processing method of claim 1,wherein the network performance parameter comprises a quantity ofservice packets that correspond to a service identifier and that arereceived by the first network node before the first network node sendsthe second packet, and wherein the service packets are forwarded alongthe path.
 4. The packet processing method of claim 1, further comprisingadding the network performance parameter of the first network node tothe segment identifier of the second network node.
 5. The packetprocessing method of claim 4, further comprising storing the networkperformance parameter between a 65th bit and a 128th bit of the segmentidentifier of the second network node.
 6. The packet processing methodof claim 1, wherein the segment list comprises a segment identifier ofthe first network node, and wherein the packet processing method furthercomprises adding the network performance parameter to the segmentidentifier of the first network node.
 7. A packet processing method,implemented by a second network node, wherein the packet processingmethod comprises: receiving a packet from a first network node, whereinthe packet comprises a segment list, wherein the segment list comprisesa segment identifier of a network node on a path that forwards thepacket, and wherein a first segment identifier in the segment listcomprises a first network performance parameter of the first networknode; determining that a destination address of the packet is a segmentidentifier of the second network node; and calculating networkperformance based on the first network performance parameter in responseto the determining.
 8. The packet processing method of claim 7, whereinthe first network performance parameter comprises a first time at whichthe first network node sends the packet to the second network node. 9.The packet processing method of claim 8, wherein the calculating furthercomprises: determining a second time at which the second network nodereceives the packet; and determining a forwarding delay that is equal toa difference between the second time and the first time.
 10. The packetprocessing method of claim 8, wherein a second segment identifier in thesegment list comprises a second network performance parameter of a thirdnetwork node, wherein the third network node is between the firstnetwork node and the second network node on the path, wherein the secondnetwork performance parameter comprises a third time at which the thirdnetwork node sends the packet to the second network node, and whereinthe calculating further comprises determining a forwarding delay that isequal to a difference between the third time and the first time.
 11. Thepacket processing method of claim 7, wherein the first networkperformance parameter comprises a first quantity of service packets thatcorrespond to a service identifier and that are received by the firstnetwork node before the second network node receives the packet, andwherein the service packets that correspond to the service identifierare forwarded along the path.
 12. The packet processing method of claim11, wherein the calculating further comprises: receiving, before thesecond network node receives the packet, a second quantity of servicepackets that correspond to the service identifier from the first networknode; and determining a quantity of lost packets during forwarding ofthe first quantity of service packets, wherein the quantity of lostpackets is equal to a difference between the second quantity and thefirst quantity.
 13. The packet processing method of claim 11, wherein asecond segment identifier in the segment list comprises a second networkperformance parameter of a third network node, wherein the secondnetwork performance parameter comprises a third quantity of servicepackets that correspond to the service identifier and that are receivedby the third network node, wherein the calculating further comprisesdetermining a quantity of lost packets during forwarding of the servicepackets corresponding to the service identifier from the first networknode to the third network node, and wherein the quantity of lost packetsis equal to a difference between the third quantity and the firstquantity.
 14. A first network node, comprising: a memory comprisinginstructions; and a processor coupled to the memory and configured toexecute the instructions, which cause the first network node to beconfigured to: obtain a first packet comprising a segment list, whereinthe segment list comprises a segment identifier of the first networknode on a path that forwards the first packet; obtain a segmentidentifier of a second network node from the segment list, wherein thesecond network node is a next-hop segment node of the first network nodeon the path; replace a destination address of the first packet with thesegment identifier of the second network node; and add a networkperformance parameter of the first network node to the segment list togenerate a second packet; and a network interface coupled to theprocessor and configured to send the second packet generated to thesecond network node.
 15. The first network node of claim 13, wherein theinstructions to add the network performance parameter further cause thefirst network node to be configured to add the network performanceparameter to the segment identifier of the second network node.
 16. Asecond network node, comprising: a network interface configured toreceive a packet from a first network node, wherein the packet comprisesa segment list, wherein the segment list comprises a segment identifierof a network node on a path that forwards the packet, and wherein afirst segment identifier in the segment list comprises a first networkperformance parameter of the first network node; and a processor coupledto the network interface and configured to: determine that a destinationaddress of the packet is a segment identifier of the second networknode; and calculate network performance based on the first networkperformance parameter in response to determining that the destinationaddress of the packet is the segment identifier of the second networknode.
 17. The second network node of claim 16, wherein the first networkperformance parameter comprises a first time at which the first networknode sends the packet to the second network node.
 18. The second networknode of claim 17, wherein the processor is further configured to:determine a second time at which the second network node receives thepacket; and determine a forwarding delay that is equal to a differencebetween the second time and the first time.
 19. The second network nodeof claim 17, wherein a second segment identifier in the segment listcomprises a second network performance parameter of a third networknode, wherein the third network node is between the first network nodeand the second network node on the path, wherein the second networkperformance parameter comprises a third time at which the third networknode sends the packet to the second network node, and wherein theprocessor is further configured to calculate the network performancebased on the first network performance parameter by determining aforwarding delay that is equal to a difference between the third timeand the first time.
 20. The second network node of claim 16, wherein thefirst network performance parameter comprises a first quantity ofservice packets that correspond to a service identifier and that arereceived by the first network node before the second network nodereceives the packet, and wherein the first quantity of service packetsare forwarded along the path.